#! /usr/bin/env python
#coding=utf-8

#导入httplib

import httplib
import base64


url='192.168.16.1'
#连接服务器
conn=httplib.HTTPConnection(url)
#auth = base64.b64encode('cleartext username'+ ':'+ 'cleartext passwords')
#headers = {"Authorization": "Basic "+ auth}
headers = {"Authorization": "Basic YWRtaW46YWRtaW4="}

#headers={'User-Agent' : 'Mozilla/5.0 (Windows NT 5.1; rv:20.0) Gecko/20100101 Firefox/20.0',
#         'Content-Type':'text/html',
#         'Authorization':'Basic YWRtaW46YWRtaW4='}
conn.request('POST',url,headers=headers)

#conn.requeset('POST','url',headers=headers)

res=conn.getresponse()
body = res.read()
print body


#关闭连接
conn.close()
